
<%--
  Created by IntelliJ IDEA.
  User: Tang'ya'kang
  Date: 2023/5/11
  Time: 14:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script>

    <title>BookManagement</title>
</head>
<%@ include file="head.jsp"%>
<script>
    $(function () {
        $(".delete").click(function () {
            //confirm("你确定要删除"+$(this).parent().parent().find(".book.name").value());
            alert('删除成功!');
        });
    });
</script>

<body>
<div class="card">
    <div class="card-body">
        <h5 class="card-title" align="center">图书管理系统</h5>
        <div class="card-body">
            <table class="table table-hover">
                <thead>
                <tr>
                    <th scope="col">#</th>
                    <th scope="col">名称</th>
                    <th scope="col">商家_id</th>
                    <th scope="col">价格</th>
                    <th scope="col">作者</th>
                    <th scope="col">销量</th>
                    <th scope="col">库存</th>
                    <th scope="col"> </th>
                    <th scope="col">操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${requestScope.books}" var="book" varStatus="status">
                <tr>
                    <th scope="row">${status.count}</th>
                    <td class="book.name">${book.name}</td>
                    <td>${book.merchant_id}</td>
                    <td>${book.price}</td>
                    <td>${book.author}</td>
                    <td>${book.sales}</td>
                    <td>${book.stock}</td>
                    <td><a href="./manage/bookServlet?action=EditById&id=${book.id}&Page=${requestScope.AccountPage.page}&user_name=${sessionScope.User.username}&merchant_id=${sessionScope.User.id}" class="badge badge-primary">修改</a></td>
                    <td><a href="./manage/bookServlet?action=DeleteBook&id=${book.id}&Page=${requestScope.AccountPage.page}&user_name=${sessionScope.User.username}&merchant_id=${sessionScope.User.id}" class="badge badge-danger delete">删除</a></td>
                </tr>
                </c:forEach>
                <tr>
                    <th scope="row"></th>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td><a href="./manage/AddBook.jsp?PageTocal=${requestScope.AccountPage.pageTocal}&user_name=${sessionScope.User.username}&merchant_id=${sessionScope.User.id}&count=${requestScope.AccountPage.count}" class="badge badge-success">增加图书</a></td>
                </tr>
                </tbody>
            </table>
            <%@ include file="/html/AccountPage_Nav.jsp"%>

        </div>
        <%@ include file="/html/Foot.jsp"%>
    </div>
</div>


</body>
</html>
